package com.aaa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;

public interface T_CommentSettingsDao {
    @Select("<script>select * from t_comment_settings  where 1=1 <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if> limit #{start},#{pageSize}</script>")
    List<Map>  list(Map map);
    @Select("<script> select  count(id) from t_comment_settings where 1=1 <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if></script>")
    Integer count(Map map);
    //添加项目
    @Insert("insert into t_comment_settings(title,begintime,endtime,state,pstate) values" +
            "(#{title},#{begintime},#{endtime},#{state},#{pstate})")
    Integer insert(Map map);
    @Delete("delete from t_comment_settings where id=#{id}")
    Integer  del(Integer id);
    @Update("update t_comment_settings set title=#{title},begintime=#{begintime},endtime=#{endtime}")
    Integer update(Map map);
    //添加评议人员
    @Select("<script>select a.id,a.number,a.password,a.name,a.pnumber,a.email,a.state,a.tid,b.tname" +
            " from appraiser a join appraiser_type b  ON  a.tid=b.id where xid=1 and state=1" +
            " limit #{start},#{pageSize}</script>")
     List<Map> person(Map map);

    @Update("update appraiser set  xid=2,state=2 where id=#{id}")
    //删除评议人员
    Integer upd(Integer id);
    @Select("<script> select a.id,a.number,a.password,a.name,a.pnumber,a.email,a.state,a.tid,b.tname" +
            "  from appraiser a join appraiser_type b  ON  a.tid=b.id where a.xid=2 </script>")
    List<Map> insertxid();
    //移除评议
    @Update("update appraiser set  xid=1,state=1 where id=#{id}")

    Integer updxid(Integer id);
    @Select("select id from appraiser where xid=2")
    List<Map>   supdxid();
    //修改参议人员状态
    @Update("update appraiser set xid=1 where xid=2")
    Integer xids();
    // 查看点击
    @Select( "select a.name,a.pnumber,a.email,b.tname from appraiser a join  appraiser_type b  ON  a.tid=b.id where a.id=#{pstate}")
    Map selectId(Integer pstate);
    @Update("update  t_comment_settings set state=2 where id=#{id}")
    Integer ups(Integer id);
}
